package com.it.whitejotterapi.controller;

import com.it.whitejotterapi.service.SysArticleService;
import com.it.whitejotterapi.tools.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: 羡羡
 * @Date: 2022/05/23/11:14
 */
@RestController
public class SysArticleController {

    @Autowired
    SysArticleService sysarservice;

    /**
     * 获取文章 且 分页
     * @param pagenum 当前页
     * @param pagesize 每页的数量
     * @return
     */
    @RequestMapping(path = "/article",method = RequestMethod.GET)
    public JsonResult article(@RequestParam(defaultValue = "1") int pagenum,int pagesize){
        return sysarservice.articleall(pagenum,pagesize);
    }

    /**
     * 查询文章详情
     * @param id 文章ID
     * @return
     */
    @RequestMapping(path = "/article/{id}",method = RequestMethod.GET)
    public JsonResult searticle(@PathVariable("id")int id){
        return sysarservice.seonearticle(id);
    }
}
